<template>
  <div class="child2">
    <h3>Child2组件，{{ car.name }}: {{car.price}}</h3>
    <Dialog></Dialog>
  </div>
</template>

<script>
import {inject, reactive} from "vue";
import Dialog from "@/components/Dialog";

export default {
  name: "Child2",
  components: {Dialog},
  props: [],
  emits: [], // 用于注册VC的自定义事件，可不写，但会报警
  setup() {
    let data = reactive({});
    let car = inject('car');
    return {
      data,
      car
    }
  },
}
</script>

<style scoped>
.child2 {
  background-color: orange;
  padding: 10px;
}
</style>